<?php
@header('Content-type:text/html;charset=UTF-8');
//ini_set('display_errors','On');
session_cache_limiter('private, must-revalidate');
define('DS', DIRECTORY_SEPARATOR);
//定义项目根目录
defined('PROJECT_ROOT')|| define('PROJECT_ROOT',realpath(dirname(__FILE__)));

//定义项目应用目录
defined('APPLICATION_PATH')|| define('APPLICATION_PATH',PROJECT_ROOT.'/application');

//定义应用环境
defined('APPLICATION_ENV')|| define('APPLICATION_ENV',(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV'): 'production'));

//设定包含目录
set_include_path(implode(PATH_SEPARATOR, array(
    PROJECT_ROOT.'/library',
    APPLICATION_PATH.'/modules',
	APPLICATION_PATH.'/models',
    get_include_path(),
)));


//载入Zend_Application
require_once 'Zend/Loader/Autoloader.php';
require_once 'Zend/Application.php';

//载入常量
require_once APPLICATION_PATH.'/configs/constants.php';

Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);

Zend_Session::start();


//实例化项目应用
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH.'/configs/application.ini');
	
try {
	$application->getBootstrap()->bootstrap('router');
	$application->bootstrap()->run();
}catch (Exception $e) {
	
   echo '对不起!出现错误了^_^<br/>';
   echo nl2br($e->__toString());
   exit;
 
   /*
   header('HTTP/1.1 301 Moved Permanently');
   header('Location:http://www.dushijia.com/error/404.html');
   exit;
     */
}





